	function onlyNumbers(evt) {
		evt = (evt) ? evt : window.event
		var charCode = (evt.which) ? evt.which : evt.keyCode
		if (charCode > 31 && (charCode < 48 || charCode > 57) && charCode != 46 && charCode != 45) {
			status = "Sólo se aceptan números."
			return false
		}
		status = ""
		return true
	}

	function del_date(mag_date){
		document.getElementById(mag_date).value="";
	}

	function doubleSubmmit(formName,divName){
		$("#Info").html("");
		saveLink=$('#frmSave').html();
		$('#frmSave').html("<center><img src='/e-ot/images/loadingAnimation.gif' /><br>Guardando información</center>");
		if (!this.beenSubmitted) {
			this.beenSubmitted = true;
			$.post("funciones.php", $(formName).serialize(),
			function(data){
				if(data.success != "y"){
					$("#Info").html(data.success);
				}
				else{
					alert("La información ha sido guardada exitosamente");
					$(divName).dialog('close');
				}
				$('#frmSave').html(saveLink);
			}, "json");
			this.beenSubmitted = false;
		}
	}
	
	function dateFormat(recdDate){
		return (recdDate == "" || recdDate=="0000-00-00" ? "" : recdDate.substring(8,10)+"/"+recdDate.substring(5,7)+"/"+recdDate.substring(0,4));
	}
	
	function 	rollover(img_name, img_src){
		document[img_name].src=img_src;
	}

  function calcCot(){
    var cot_total=0;
    $(".mag_cotizacion_valor").each(function(){
      cot_total+= ($(this).val()!="" ? parseFloat($(this).val().replace(/,/g,"")) : 0);
    });
    $('#total_cotizaciones').html(cot_total).format({format:"#,###.00"});
    $('#total_cotizaciones').prepend("Total de cotización $");
  }

  function calcBuy(){
    var buy_total=0;
    $(".mag_compra_valor").each(function(){
      buy_total+= ($(this).val()!="" ? parseFloat($(this).val().replace(/,/g,"")) : 0);
    });
    $('#total_compras').html(buy_total).format({format:"#,###.00"});
    $('#total_compras').prepend("Total de órdenes de compra $");
  }

	function removeElem(elem){
    $(elem).parent().prev().parent().remove();
      var x=0;
      $(".mail_group").each(function(){
        $(this).find(".mag_mail").attr('name', 'mag_mail['+x+']');
        x++;
      });
      x=0;
      $(".mag_cliente").each(function(){
        x++;
      });
      if(x==1)
      {
        $('#selectClient').removeAttr('disabled');
      }
	}

